﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetworkLib.Utilities;
using PokemonBattle.BattleNetwork;

namespace PokemonBattle.BattleRoom.Server
{
    public class ChallengeInfo : DataByteArray
    {
        public BattleMode BattleMode { get; set; }
        public BattleLinkMode LinkMode { get; set; }
        public BattleRuleSequence Rules { get; set; }

        #region abstract

        public override void Read(ByteArray byteArray)
        {
            BattleMode = BattleModeHelper.Parse(byteArray.ReadInt());
            LinkMode = BattleLinkModeHelper.Parse(byteArray.ReadInt());
            this.Rules = FromByteArray<BattleRuleSequence>(byteArray);
        }

        public override void Write(ByteArray byteArray)
        {
            byteArray.WriteInt((int)this.BattleMode);
            byteArray.WriteInt((int)this.LinkMode);
            Rules.Write(byteArray);
        }

        #endregion

    }
}